package br.com.imob.modelo;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Gilton Nascimento
 */
@Entity
@Table(name = "\"NEGOCIO\"", catalog = "imob", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Negocio.findAll", query = "SELECT n FROM Negocio n"),
    @NamedQuery(name = "Negocio.findByNegocioId", query = "SELECT n FROM Negocio n WHERE n.negocioId = :negocioId"),
    @NamedQuery(name = "Negocio.findByNegocio", query = "SELECT n FROM Negocio n WHERE n.negocio = :negocio"),
    @NamedQuery(name = "Negocio.findLikeByNegocio", query = "SELECT n FROM Negocio n WHERE n.negocio Like :negocio")
    })
public class Negocio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
//  <editor-fold defaultstate="collapsed" desc="Geradores de Sequencias">
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
    @SequenceGenerator(name = "SEQ_STORE", sequenceName = "next_negocio")// </editor-fold>
    @Basic(optional = false)
    @Column(name = "negocio_id", nullable = false)
    private Integer negocioId;
    @Column(name = "negocio", length = 100)
    private String negocio;
    @OneToMany(mappedBy = "negocio", fetch = FetchType.LAZY)
    private List<Imovel> imovelList;

    public Negocio() {}

    public Negocio(Integer negocioId) {
        this.negocioId = negocioId;
    }
    
    public Negocio(String negoc) {
    	negocio = negoc;
    }

	public Negocio(int id, String negocio2) {
		negocioId = id;
		negocio = negocio2;
	}
	
	
//	Getts and Setts
	public Integer getNegocioId() {
        return negocioId;
    }

    public void setNegocioId(Integer negocioId) {
        this.negocioId = negocioId;
    }

    public String getNegocio() {
        return negocio;
    }

    public void setNegocio(String negocio) {
        this.negocio = negocio;
    }

    public List<Imovel> getImovelList() {
        return imovelList;
    }

    public void setImovelList(List<Imovel> imovelList) {
        this.imovelList = imovelList;
    }
    
    public Object[] getValues() {
    	Object[] objects = {negocioId, negocio};
    	return objects; 
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (negocioId != null ? negocioId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Negocio)) {
            return false;
        }
        Negocio other = (Negocio) object;
        if ((this.negocioId == null && other.negocioId != null) || (this.negocioId != null && !this.negocioId.equals(other.negocioId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.imob.modelo.Negocio[negocioId=" + negocioId + "]";
    }

}
